import time
import unittest
import utils
import requests

from api.login import LoginApi
from api.trust_account import TrustAccountApi


class TestApproveRealname(unittest.TestCase):

    @classmethod
    def setUpClass(cls) -> None:
        cls.login_api = LoginApi()
        cls.trust_account = TrustAccountApi()

    def setUp(self) -> None:
        self.session = requests.Session()
        self.login_api.login(self.session, "13012345678", "test123")

    def tearDown(self) -> None:
        self.session.close()

    # 实名认证成功（正确的姓名和身份证号）
    def test01_approve_realname_success(self):
        # 测试数据
        realname = "小一"
        card_id = "110101199003072447"

        # 调用接口
        r = self.trust_account.approve_realname(self.session, realname, card_id)
        print("approve realname data=", r.json())

        # 断言
        utils.common_assert(self, r, 200, 200, "提交成功")
